package com.buyouchina.web.action.privilege;

import java.lang.reflect.Method;

/*
 * 注解解析器
 */
public class ValidatePermission {
	public static Permission parsePermission(Class<?> clazz, String methodName,
			Class<?>... parameterTypes) throws NoSuchMethodException {
		// 根据方法名，取得方法，如果有则返回
		Method method = clazz.getMethod(methodName, parameterTypes);
		if (method != null && method.isAnnotationPresent(Permission.class)) {
			Permission permission = method.getAnnotation(Permission.class);
			if (null != permission)return permission;
		}
		return null;
	}
}

